<script>
	export default {
		globalData: {
			appId: 'wxcea0ee4d16192c35',
			// appSecret: "42903a181a4a023c969b68fd9fc05090",
			userInfo: null,
		},
		onLaunch: function() {
			// console.log('App Launch')
			// 获取小程序的openId
			const yeyuMiniOpenId = uni.getStorageSync('yeyuMiniOpenId');
			if (!yeyuMiniOpenId) {
				uni.login({
					success: (res) => {
						// const url = `https://api.weixin.qq.com/sns/jscode2session?appid=${appId}&secret=${appSecret}&js_code=${code}&grant_type=authorization_code`;
						const code = res.code || '';
						this.$request('/xcx/openid', {
							params: {
								code,
							},
							success: res => {
								const openId = res.body || '';
								uni.setStorageSync('yeyuMiniOpenId', openId);
							},
						});
					}
				})
			}
			
		},
		onShow: function() {
			// console.log('App Show')
		},
		onHide: function() {
			// console.log('App Hide')
		}
	}
</script>

<style>
	/*每个页面公共css */
	
	cover-view,
	view {
		box-sizing: border-box;
	}
</style>
